package collect

import (
	"github.com/prometheus/client_golang/prometheus"
)

type Exporter struct {
	collectors []prometheus.Collector
}

func NewExporter() *Exporter {
	return &Exporter{
		collectors: []prometheus.Collector{},
	}
}
func (e *Exporter) AddCollector(collector ...prometheus.Collector) {
	e.collectors = append(e.collectors, collector...)
}

func (e *Exporter) Describe(ch chan<- *prometheus.Desc) {
	for _, collector := range e.collectors {
		collector.Describe(ch)
	}
}
func (e *Exporter) Collect(ch chan<- prometheus.Metric) {
	for _, collector := range e.collectors {
		collector.Collect(ch)
	}
}
func (e *Exporter) GetGatherers() prometheus.Gatherer {
	reg := prometheus.NewPedanticRegistry()
	reg.MustRegister(e)
	return prometheus.Gatherers{reg}
}
